home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / vidbasic.zip / VCPAGE.ASM < prev    next >
Assembly Source File  |  1990-11-29  |  3KB  |  100 lines

  1. ;«RM82»«TS8,16,24,32,40,48,56,64»
  2. ; Updated 11/20/90
  3.  
  4. ;============================================================================
  5. ;   Copyright (C) Copr. 1990 by Sidney J. Kelly
  6. ;           All Rights Reserved.
  7. ;           Sidney J. Kelly
  8. ;           150 Woodhaven Drive
  9. ;           Pittsburgh, PA 15228
  10. ;           home phone 412-561-0950 (7pm to 9:30pm EST)
  11. ;============================================================================
  12.  
  13. DOSSEG
  14. .MODEL MEDIUM
  15.     PUBLIC  CHANGEPAGE
  16. .data
  17.     ;external data so all video routines can access
  18.     EVEN
  19.     EXTRN  B$DVIDEOSEG:WORD     ;inside VDATA
  20.     EXTRN  B$DVIDEOPORT:WORD    ;inside VDATA
  21.     EXTRN  B$DVIDEOINSTL:BYTE   ;inside VDATA
  22. .code
  23.  
  24. EXTRN    Get_Adapter:FAR              ;inside VDATA
  25.  
  26. ;===========================================================================
  27. ; DECLARE SUB CHANGEPAGE ()
  28. ; CALL CHANGEPAGE
  29. ;Purpose:
  30. ;        Adjust the current VIDEOSEG to reflect current active page
  31. ;     Also reinitializes Video Data Area
  32. ;
  33. ;Limit:
  34. ;        This will permit 25, 43, & 50 line displays
  35. ;        Note on many HERC's the page size is fixed at 16kb even though
  36. ;        it really is 4kb in Text Mode
  37. ;
  38. ;Returns:
  39. ;     Nothing Video Data Area Filed
  40. ;===========================================================================
  41.  
  42. EVEN
  43. CHANGEPAGE    PROC    FAR
  44.     Push    BP                ;save BP in case video bios destroys it
  45.  
  46. Reset_Page_0:                ;reset BASE Segment to page 0
  47.         Xor    AX,AX             ;zero out AX
  48.     Mov    ES,AX             ;put zero in ES, to look at low memory
  49.     Mov    BX,0B000h         ;assume the Mono screen segment
  50.     Mov    AL,ES:[463h]      ;get CRT controller port address 0000:0463h
  51.     Cmp    AL,0B4h           ;is it mono?
  52.     JZ     Have_Mono         ;yes, don't add 800h to video segment
  53.     Add    BX,0800h          ;no, adjust BX for a color monitor
  54.  
  55.         Cmp       B$DVIDEOINSTL,1   ;Is that video port status accurate?
  56.     JE    Buffer_Set        ;yes, so skip ahead
  57.                   ;test if color VGA/EGA or a CGA
  58.     Push    BX                ;save BX because the EGA test destroys BX
  59.  
  60.     Mov    AH,12h            ;specify EGA BIOS special function service
  61.     Mov    BL,10h            ;request EGA info
  62.         Int    10h               ;call the BIOS
  63.         Cmp    BL,10h            ;if BL is still 10h, there's no EGA
  64.     JNE    Color_EGA         ;it is an EGA, skip ahead
  65.  
  66. Snowy_CGA:
  67.                   ;its a CGA,  set video retrace port
  68.     Mov     B$DVIDEOPORT,3DAh ;and store in data area
  69.                   ;assume CGA will cause snow
  70. Color_EGA:
  71.     Pop    BX                  ;get the video segment again
  72.  
  73. Have_Mono:
  74.     Mov    B$DVIDEOINSTL,1   ;note that it is now installed
  75.  
  76. Buffer_Set:
  77.         ;BX contains Page 0 Segment Address
  78.  
  79.         XOR    CH,CH             ;clear the high byte
  80.     Mov    CL,Byte Ptr ES:[0462h] ;get current page number
  81.     JCXZ    Finis1            ;if it is page 0, then quit
  82.  
  83.     Mov     DX,CX             ;store CX temporarily in DX
  84.     Mov     AX,ES:[044Ch]     ;get current page size
  85.     Mov     CL,4
  86.     Shr     AX,CL             ;divide page size by 16
  87.     Mov     CX,DX             ;get page number back into CX
  88.  
  89. EVEN
  90. Adj_Page:       ;allows for 25, 43 & 50 line pages in text mode
  91.     Add     BX,AX             ;adjust one page ahead
  92.     Loop    Adj_Page          ;loop until page (CX) = 0
  93.  
  94. Finis1:
  95.         Mov     B$DVIDEOSEG,BX    ;store current segment address
  96.     Pop    BP                ;for currently active page
  97.     Ret
  98. CHANGEPAGE    ENDP
  99. END
  100.